//绘本旁白
const state = {
    words: [], //旁白
    wordDialogueIndex: "",
    wordImagery: "",
    indexDialogue: {},
    dialogueSerialNumbers: 0
}
const getters = {
    //获取绘本旁白
    getWord(state) {
        return state.words;
    },
    //获取当前收集的意象名
    getWordImagery(state) {
        return state.wordImagery
    },
    getIndexDialogue(state) {
        return state.indexDialogue
    },
    //获取对话标识
    getDialogueSerialNumbers(state) {
        return state.dialogueSerialNumbers
    }
};
const mutations = {
    //绘本旁白初始化
    setWord(state, param) {
        state.words = param
        state.wordInDialogue = []
        state.dialogueSerialNumbers = 0
    },
    //设置当前收集的意象名
    setWordImagery(state, param) {
        state.wordImagery = param
    },
    setIndexDialogue(state, param) {
        state.indexDialogue = param
    },
    //改变对话标识
    updateDialogueSerialNumbers(state, param) {
        state.dialogueSerialNumbers = param
    },
};
const actions = {
    setWord({
        commit
    }, param) {
        commit("setWord", param);
    },
    //1.5s后清空意象名 防止重复点击无法监听
    setWordImagery({
        commit
    }, param) {
        setTimeout(() => { state.wordImagery = "" }, 1500)
        commit("setWordImagery", param)
    },
    setIndexDialogue({ commit }, param) {
        commit("setIndexDialogue", param)
    },
    updateDialogueSerialNumbers({ commit }, param) {
        commit("updateDialogueSerialNumbers", param)
    }
};
export default {
    namespaced: true, //用于在全局引用此文件里的方法时标识这一个的文件名
    state,
    getters,
    mutations,
    actions
}
